package com.liaoyifan.core.valid.constraints;

import com.liaoyifan.core.model.CoreService;
import com.liaoyifan.core.valid.validator.InvokeValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.*;

@SuppressWarnings("unused")
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = InvokeValidator.class)
@Repeatable(Invoke.List.class)
@Documented
public @interface Invoke {

    String message() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    Class<? extends CoreService<?, ?>> service();

    String method();

    @SuppressWarnings("UnusedReturnValue")
    @Target({ElementType.FIELD, ElementType.PARAMETER})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface List {
        Invoke[] value();
    }
}
